﻿using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Yes.Application;
using Yes.Application.File;


namespace Yes.Web.Blog.Areas.Admin.Controllers
{
    [Area("Admin")]
    public class FileController : BaseController
    {
        private IFileService _fileService;
        private IHostingEnvironment _host = null;


        public FileController(IFileService fileService, IHostingEnvironment host)
        {
            _fileService = fileService;
            _host = host;
        }


        [HttpPost]
        public ActionResult Delete(string path)
        {
            string webRootPath = _host.WebRootPath;

            return Json(_fileService.Delete(webRootPath+"\\" + path));
        }
    }
}